1Imports System.Windows.Forms 2 3Public Class RenameStopwatch 4 5 Private Sub RenameStopwatch_Load(sender As Object, e As EventArgs) Handles MyBase.Load 6 Dim selItem As String 7 Dim strArr() As String 8 strArr = stopwatch.KryptonListBox1.SelectedItem.Split("|") 9 selItem = (strArr(0).ToString) 10 TextBox1.Text = selItem.Substring(0, selItem.Length - 1) 11 End Sub 12 13 Private Sub KryptonButton2_Click(sender As Object, e As EventArgs) Handles KryptonButton2.Click 14 Me.Close() 15 End Sub 16 17 Private Sub KryptonButton1_Click(sender As Object, e As EventArgs) Handles KryptonButton1.Click 18 Dim selItem As String 19 Dim strArr() As String 20 strArr = stopwatch.KryptonListBox1.SelectedItem.Split("| ") 21 selItem = (strArr(1).ToString) 22 stopwatch.KryptonListBox1.Items.Remove(stopwatch.KryptonListBox1.SelectedItem) 23 stopwatch.KryptonListBox1.Items.Add(TextBox1.Text & " | " & selItem) 24 Me.Close() 25 End Sub 26 27 Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown 28 If e.KeyCode = Keys.Enter Then 29 Dim selItem As String 30 Dim strArr() As String 31 strArr = stopwatch.KryptonListBox1.SelectedItem.Split("| ") 32 selItem = (strArr(1).ToString) 33 stopwatch.KryptonListBox1.Items.Remove(stopwatch.KryptonListBox1.SelectedItem) 34 stopwatch.KryptonListBox1.Items.Add(TextBox1.Text & " | " & selItem) 35 Me.Close() 36 End If 37 38 If e.KeyCode = Keys.Escape Then 39 Me.Close() 40 End If 41 End Sub 42 43End Class